﻿using System.Collections.Generic;
using System.IO;
using System.Linq;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using BMCShowView.Business;

namespace BMCShowView.Test
{
    [TestClass]
    public class ExcelReaderTester
    {
        [TestMethod]
        public void TestArrangeTable()
        {
            List<List<string>> list;
            using (var stream = File.OpenRead("Files/2014-12.xlsx"))
            {
                list = ArrangeTable.ReadFromStream(stream);
            }
            Assert.AreEqual(31, list.Count);
            CollectionAssert.AreEqual(list.Select(x => x.Count).ToArray(),
                new[] {
                    3,3,3,3,3,2,2,
                    3,3,3,3,3,2,2,
                    3,3,3,3,3,2,2,
                    3,3,3,3,3,2,2,
                    3,3,3
                });
            Assert.AreEqual("白晨云", list[11][0]);
            Assert.AreEqual("陈波 白晨云", list[14][1]);
            Assert.AreEqual("孙阳 任韵", list[30][2]);
        }
    }
}
